<?php

namespace App\Msg;

class MsgInfo {
	const ACTION_NOT_FOUND = "请求方法不存在";
	const ADD_USER_REQUSET_SUCESS = "添加好友请求成功";
	const SYSTEM_MSG_TITLE = "系统消息";
	const FRIEND_MSG_TITLE = "好友消息";
	const WORLD_MSG_TITLE = "世界消息";
	const ONLINE_NUM_TITLE = "在线数量";
	static function User($code): string {
		if (empty ( $code )) {
			return "";
		}
		$language = "zh";
		$msg = [ 
				$language => [ 
						MsgCode::USER_EXIST => "用户已经存在",
						MsgCode::ACCOUNT_IS_NULL => "账号不能为空",
						MsgCode::USER_NOT_EXIST => "用户不存在",
						MsgCode::USER_PASSWORD_ERROR => "用户密码错误",
						MsgCode::TOKEN_IS_NULL => "请登陆获取token",
						MsgCode::USER_NOT_LOGIN => "Token失效或者用户没有登录",
						MsgCode::CHAT_OPEN_SUCCESS => "打开聊天成功",
						MsgCode::GET_USER_SUCCESS => "获取用户信息成功",
						MsgCode::PHONE_FORMAT_ERROR => "手机号格式错误",
						MsgCode::EMAIL_FORMAT_ERROR => "邮箱格式错误",
						MsgCode::PASSWORD_IS_NULL => "密码不能为空",
						MsgCode::PASSWORD_LENGTH_ERROR => "密码长度6-16",
						MsgCode::USER_IS_LOGIN => "用户已经登录" 
				] 
		];
		if ($msg [$language] [$code]) {
			return $msg [$language] [$code];
		} else {
			return "";
		}
	}
	static function friend($code) {
		if (empty ( $code )) {
			return "";
		}
		$language = "zh";
		$msg = [ 
				$language => [ 
						MsgCode::FRIENDUID_IS_NYLL => "好友的UID不能为空",
						MsgCode::FROEND_NOT_EXIST => "没有找到您的好友",
						MsgCode::FRIEND_DB_ERROR => "好友数据库错误",
						MsgCode::ADD_FRIEND_LOG_EXIST => "申请记录已经存在",
						MsgCode::NOT_REPEAT_ADD_FRIEND => "你们已经是好友不能重复添加",
						MsgCode::FRIEND_KEY_NULL => "主键不能为空",
						MsgCode::FRIEND_STATUS_NULL => "状态不能为空",
						MsgCode::NOT_FRIEND => "不是你的好友",
						MsgCode::FRIEND_NOT_ONLINE => "好友不在线",
						MsgCode::NOT_ADD_SELF_FRIEND => "不能添加自己为好友" 
				
				] 
		];
		if ($msg [$language] [$code]) {
			return $msg [$language] [$code];
		} else {
			return "";
		}
	}
	static function message($code) {
		if (empty ( $code )) {
			return "";
		}
		$language = "zh";
		$msg = [ 
				$language => [ 
						MsgCode::ADD_MESSAGE_DB_ERROR => "添加消息数据库错误",
						MsgCode::SEND_MSG_NULL => "发送的消息不能为空" 
				] 
		];
		if ($msg [$language] [$code]) {
			return $msg [$language] [$code];
		} else {
			return "";
		}
	}
	static function common($code) {
		if (empty ( $code )) {
			return "";
		}
		$language = "zh";
		$msg = [ 
				$language => [ 
						MsgCode::OPERAT_FAIL => "操作失败" 
				] 
		];
		if ($msg [$language] [$code]) {
			return $msg [$language] [$code];
		} else {
			return "";
		}
	}
}